//-------------------------------------------------------
// Copyright (c) 
// All rights reserved.
//
// File Name: CIPCWndClient.h
// File Des: 窗口消息进程内/间通信 client 接口对象
// File Summary:
// Cur Version: 1.0
// Author:lzlong
// Create Data:2023-8-10
// History:
//         <Author>    <Time>        <Version>      <Des>
//      lzlong        2023-8-10     1.0
//-------------------------------------------------------
#pragma once
#include <Windows.h>
#include <string>

class CIPCWndClient
{
public:
    CIPCWndClient(const std::wstring& _strName);

    CIPCWndClient(void);

    ~CIPCWndClient(void);

    void set_connect_host_name(const std::wstring& _strName);

    void set_host_server_hwnd(HWND hWnd);

    void set_bfind_wnd_every_time(bool b);

    LRESULT send_message(UINT msg, WPARAM wParam, LPARAM lParam);
    
    LRESULT post_message(UINT msg, WPARAM wParam, LPARAM lParam);

    LRESULT send_msg_string(const std::string& strMsg, int iMark = 8888);

    LRESULT send_msg_string(const std::wstring& strMsg, int iMark = 8888);

    LRESULT send_msg_stringA(const std::string& strMsg, int iMark = 8888);

    LRESULT send_msg_stringW(const std::wstring& strMsg, int iMark = 8888);

    LRESULT send_buffer(ULONG iMark, PVOID lpData, DWORD iBufferLen, WPARAM wparam = 0);

protected:
    LRESULT send_msg(UINT msg, WPARAM wParam, LPARAM lParam, bool b_send);

private:

    HWND        m_hHostWindow;

    std::wstring m_strHostName;

    WCHAR        m_szHostRegClsName[50];

    bool        m_bFindWndEveryTime;
};

